{% extends "default.html" %}

{% load i18n %}
{% load jalali_view %}
{% load digg_paginator %}

{% block title %} {% trans "Ads List" %}{% endblock %}

{% block page_content %}

<h3>{% trans "Ads" %}</h3>

{% if message %}
<div class="span-10 last" style="color: orange;">{{ message }}</div>
{% endif %}

<div class="span-18 last">
<span><a href="/ads/register/">{% trans "Register New Ad" %}</a></span>
<table border="1" cellpadding="0" cellspacing="0">
	<thead>
		<tr>
			<th>{% trans "Enabled" %}</th>
			<th>{% trans "Title" %}</th>
			<th>{% trans "Advertizer" %}</th>
			<th>{% trans "Registration Date" %}</th>
			<th>{% trans "Publish Start Date" %}</th>
			<th>{% trans "Publish End Date" %}</th>
			<th></th>
		</tr>
	</thead>
	{% for ad in current_page.object_list %}
	<tr>
		<td>
		{% if ad.enabled %}
		<img src="/media/img/admin/icon-yes.gif" />
		{% else %}
		<img src="/media/img/admin/icon-no.gif" />
		{% endif %}
		</td>
		<td>{{ ad.title }}</td>
		<td>{{ ad.advertizer }}</td>
		<td>{% jalali_view ad.registration_date %}</td>
		<td>{% jalali_view ad.start_date %}</td>
		<td>{% jalali_view ad.end_date %}</td>
		<td>
			<a href="/ads/view/{{ ad.id }}/">{% trans "View" %}</a> &bull;
			<a href="/ads/update/{{ ad.id }}/">{% trans "Edit" %}</a> &bull;
			<a href="/ads/delete/{{ ad.id }}/" 
			   onclick='return (confirm("{% trans "Are you sure to delete this object?" %}"))'>
			   {% trans "Delete" %}</a>
		</td>
	</tr>
	{% endfor %}
</table>
</div>

{% digg_paginator %}

{% endblock page_content %}
